﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Benefit.Models.Day
{
    /// <summary>
    /// 持仓时间和收益率
    /// </summary>
    public class YieldInHoldTime
    {
        public int Id { get; set; }

        public int AccountId { get; set; }

        public virtual Sys.Account Account { get; set; }
        /// <summary>
        /// 持仓时间
        /// </summary>
        public int HoldTime { get; set; }
        /// <summary>
        /// 收益率
        /// </summary>
        public int Yield { get; set; }

        public int TradeHistoryId { get; set; }

        public virtual Sys.TradeHistory TradeHistory { get; set; }

        ///// <summary>
        ///// 删除持仓时间收益情况
        ///// </summary>
        ///// <param name="tradeHistoryId"></param>
        //public void DeleteYieldHoldTime(int tradeHistoryId, DB.DBManager db)
        //{
        //    var query = db.YieldInHoldTime.Where(a => a.TradeHistoryId == tradeHistoryId);
        //    foreach (Data.Day.YieldInHoldTime t in query)
        //    {
        //        db.YieldInHoldTime.Remove(t);
        //    }
        //    db.SaveChanges();
        //}
        ///// <summary>
        ///// 获取一个账号的持仓收益率情况
        ///// </summary>
        ///// <param name="tradeHistoryId"></param>
        ///// <param name="accountid"></param>
        ///// <returns></returns>
        //public List<YieldInHoldTime> GetYieldInHoldTime(int tradeHistoryId, int accountid, DB.DBManager db)
        //{
        //    List<YieldInHoldTime> times = new List<YieldInHoldTime>();
        //    var query = db.YieldInHoldTime.Where(a => a.TradeHistoryId == tradeHistoryId).Where(a => a.AccountId == accountid);
        //    foreach (Data.Day.YieldInHoldTime t in query)
        //    {
        //        times.Add(t);
        //    }
        //    return times;
        //}
    }
}
